package com.che.libcommon.widget.slidinguppanel;

import android.support.v4.widget.NestedScrollView;
import android.view.View;

public class NestedScrollableViewHelper extends ScrollableViewHelper {
  public int getScrollableViewScrollPosition(View scrollableView, boolean isSlidingUp) {
    if (scrollableView instanceof NestedScrollView) {
      if(isSlidingUp){
        return scrollableView.getScrollY();
      } else {
        NestedScrollView nsv = ((NestedScrollView) scrollableView);
        View child = nsv.getChildAt(0);
        return (child.getBottom() - (nsv.getHeight() + nsv.getScrollY()));
      }
    } else {
      return 0;
    }
  }
}